#include <bits/stdc++.h>
using namespace std;
int n;
int a[10010];int b;
vector <int> q;
void sor(){

    int an=1;
     for (int i=1;i<=n;i++){
            int m=10001,f=0;
            for(int j=an;j<=n;j++){
                if(a[j]<m){
                    m=a[j];
                    f=j;
                }
            }
            a[f]=a[an];
            a[an]=m;
            an++;
        }
     }
int main (){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    int ans=0,f[10010],now;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=1;i<=10000;i++){
        f[i]=0;
    }
    sor();
    now=a[1];
    for(int i=1;i<=n;i++){
        f[a[i]]++;
        while (f[now]==0){
            now++;
        }
         if (a[i]>now&&f[now]!=0){

                ans++;
            f[now]--;


            }
    }
    n=n-ans;
    printf("%d",n);
    return 0;
}
